<?php
/**
 * Created by jinqiang on 2024/7/9 9:41.
 * Copyright (c) 2024, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Wms;


use App\Http\Controllers\Controller;
use App\Http\Services\Wms\BaociService;
use Illuminate\Http\Request;

class BaociController extends Controller
{
    public function list(Request $request, BaociService $baociService)
    {
        $this->validate($request, [
            'page' => 'required',
            'limit' => 'required'
        ]);
        $param = $request->all();
        $res = $baociService->search($param);
        return result($res);
    }

    public function detail(Request $request, BaociService $baociService)
    {
        $this->validate($request, [
            'allocation_number' => 'required'
        ]);
        $param = $request->all();
        $res = $baociService->detail($param['allocation_number']);
        return result($res);
    }

    public function apply(Request $request, BaociService $baociService)
    {
        $this->validate($request, [
            'remark' => 'required',
            'list' => 'required'
        ]);
        $param = $request->all();
        $res = $baociService->apply($param);
        return $res['code'] === 0 ? success("操作成功") : error($res['msg'], $res);
    }
}
